package com.ihg.hiex.entity.session.during.report;

import org.apache.commons.lang3.StringUtils;

import com.demo2do.core.utils.Alias;

/**
 * Session版本
 * 
 * @author downpour
 *
 */
@Alias("SessionEdition")
public enum SessionEdition {
    
    FIRST_EDITION("初版", "first"),
    
    AMEND("修改版本", "amend"),
    
    FINAL("最终版本", "final");

    private String description;
    
    private String alias;
    
    /**
     * 
     * @param description
     * @param alias
     */
    private SessionEdition(String description, String alias) {
        this.description = description;
        this.alias = alias;
    }

    /**
     * 
     * @param alias
     * @return
     */
    public static SessionEdition aliasOf(String alias) {
        for(SessionEdition sessionEdition : SessionEdition.values()) {
            if(StringUtils.equalsIgnoreCase(sessionEdition.getAlias(), alias)) {
                return sessionEdition;
            }
        }
        return null;
    }
    
    /**
     * 
     * @return
     */
    public boolean isFirst() {
        return this.equals(FIRST_EDITION);
    }
    
    /**
     * 
     * @return
     */
    public boolean isAmend() {
        return this.equals(AMEND);
    }
    
    /**
     * 
     * @return
     */
    public boolean isFinal() {
        return this.equals(FINAL);
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @return the alias
     */
    public String getAlias() {
        return alias;
    }

}
